import jwt from 'jsonwebtoken';



const SECRET_KEY ='XTihBHY00Y6PHTA5FSryGG';

interface TokenPayload  {
    id: string,
    username: string|null,
    orgId: string,
    roleId: string
  }

function generateToken() {
  const payload: TokenPayload =  {
    id: '14',
    username: null,
    orgId: '12',
    roleId: 'ASSESSMENT_SUPERVISOR'
  };
  // 生成 token，设置24小时过期
  const token = jwt.sign(payload, SECRET_KEY, {
    expiresIn: '24h',
  });

  console.log('Generated JWT Token:');
  console.log(token);
  
  // 验证 token (可选，用于测试)
  try {
    const decoded = jwt.verify(token, SECRET_KEY);
    console.log('\nDecoded token:');
    console.log(decoded);
  } catch (err) {
    console.error('Token verification failed:', err);
  }
}

generateToken(); 